<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{margin: 0;padding: 0;}
        div{
            width: 200px;
            height: 200px;
            background: skyblue;
        }
    </style>
</head>
<body>
    <button class="btn">按钮</button>
    <div></div>
    <script src="../jquery-3.6.0.js"></script>
    <script>
        $('.btn').on('click',function(){
            // $('div').slideToggle(1000)
           if($('div').css('width')=='200px'){
            $('div').animate({
                width:400,
                height:400,
                opacity:0.4,
            },500)
           }else{
            $('div').animate({
                width:200,
                height:200,
                opacity:1,
            },500)
           }
        })
    </script>
</body>
</html>